#!/bin/bash
echo "1.初始化操作系统环境"
yum update -y
yum remove docker  docker-common docker-selinux docker-engine
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
echo "2.安装docker-ce"
yum install -y docker-ce
systemctl start docker
systemctl enable docker
docker version

echo "3.安装docker-compose"
curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version

echo "4.配置docker 镜像加速"

cat > /etc/docker/daemon.json << EOF
{
	 "registry-mirrors": [ "https://03qe6qjc.mirror.aliyuncs.com", "https://registry.docker-cn.com" ]
	  ,"data-root": "/data/docker"
}
EOF

systemctl daemon-reload
systemctl start docker

echo "5.安装辅助工具"

yum install -y lrzsz unzip zip 
